<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>#{msg.page_Weather}</title>
    <h:outputStylesheet library="css" name="table-style.css"/>

</h:head>
<h:body>


    <ui:decorate template="/sample.xhtml">
        <ui:define name="body">
            <h:outputLabel value="#{msg.text_WeatherView}"/> <br/>
            <h:form>
                <p:selectOneMenu value="#{city.countryUser}" valueChangeListener="#{city.countrySet}" onchange="submit()">
                    <f:selectItem itemLabel="---" itemValue=""/>
                    <f:selectItems value="#{city.countries}" var="j" itemLabel="#{j.name}" />

                </p:selectOneMenu>

                <br/> <br/> <br/>
                <p:selectOneMenu value="#{weather.cities}" valueChangeListener="#{weather.citiesSet}" onchange="submit()">
                    <f:selectItem itemLabel="---" itemValue=""/>
                    <f:selectItems value="#{city.cities}" var="j1" itemLabel="#{j1.value}" itemValue="#{j1.id}" />

                </p:selectOneMenu>
            </h:form>

            <h:panelGroup id="infoWather" rendered="#{weather.forecast!=null}">
                <br/>
                <h:outputLabel value="#{msg.text_country} : #{weather.forecast.country}"/> <br/>
                <h:outputLabel value="#{msg.text_city} : #{weather.forecast.city}"/><br/>
                <h:outputLabel value="#{msg.text_part} : #{weather.forecast.part}"/><br/>
            </h:panelGroup>


            <h:dataTable value="#{weather.forecast.day}" var="item"
                         styleClass="order-table"
                         headerClass="order-table-header"
                         rowClasses="order-table-odd-row,order-table-even-row"
                    >


                <h:column>
                    <f:facet name="header" >
                        Дата
                    </f:facet>
                    #{item.date}
                </h:column>

                <h:column>

                    <h:dataTable value="#{item.hour}" var="d"  styleClass="order-table"
                                 headerClass="order-table-header"
                                 rowClasses="order-table-odd-row,order-table-even-row">
                        <h:column>
                            <f:facet name="header" >
                                <h:outputText value="Время" />
                            </f:facet>
                            #{d.at} :00
                        </h:column>
                        <h:column>
                            <f:facet name="header" >
                                <h:outputText value="Погода" />
                            </f:facet>
                            #{d.temperature}
                        </h:column>
                    </h:dataTable>

                </h:column>


            </h:dataTable>



            <!--<f:facet name="header" >-->
            <!--<h:outputText value="ID" />-->
            <!--</f:facet>-->






        </ui:define>
    </ui:decorate>










</h:body>
</html>


